<?php
class Zendvn_View_Helper_AdminToolbarButtons extends Zend_View_Helper_Abstract{

	public function adminToolbarButtons($moduleOptions = null,$request = null){
		$view= $this->view;
		$component = $request['component'];
		$fileConfigs =BASE_PATH.DS.'library'.DS.'zendvn'.DS.'view' .DS.'helper' .DS.'AdminToolbarData' .DS.'common.ini';
		$configObj = new Zendvn_Config($fileConfigs);
		$defaultButton = $configObj->getConfig();
		$btnList = explode('|', $moduleOptions['btnList']);
		//override
		foreach ($btnList as $btn){
			if($btn != "divider"){
				$moduleButton[] = array_merge($defaultButton[$btn],$moduleOptions[$btn]);
			}else {
				$moduleButton[] = array("divider" =>"divider");
			}
		}
		foreach ($moduleButton as $button){
			$links = $view->zenjooUrl(array(
						'option'=>$component['name'],
						'control'=>$component['control'],
						'activity'=>$button['target']['activity'])
			,'admin-'.$component['name'].'-'.$component['control'].'-'.$button['target']['activity'],array(),false);
			$xhtml .= $view->adminToolbarButton(null,$links,null,$button);
		}
		return $xhtml;
	}
}



